﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.ManutencaoOrdens.Communication.Translator.DataContractToModel
{
    public class ConsultaAssessor
    {
        public Model.Assessor ToAssessor(Bovespa.Movimento.ConsultaAssessor.AssessorResponse from)
        {
            Model.Assessor to = null;

            if (from != null)
            {
                to = new Model.Assessor();
                to.Codigo = from.Codigo;
                to.Nome = from.Nome;
            }

            return to;
        }

        public ModelCollection<Model.Assessor> ToAssessor(List<Bovespa.Movimento.ConsultaAssessor.AssessorResponse> from)
        {
            ModelCollection<Model.Assessor> to = null;

            if (from != null)
            {
                to = new ModelCollection<Model.Assessor>();

                foreach (Bovespa.Movimento.ConsultaAssessor.AssessorResponse item in from)
                {
                    to.Add(ToAssessor(item));
                }
            }

            return to;
        }
    }
}
